﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Modules/Master/main.master" AutoEventWireup="true" CodeFile="DataBrowse.aspx.cs" Inherits="Modules_IA_DataBrowse" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style>
        .bgimages {
            line-height:30px;
            height:30px;
            background-image:url(images/Mtopnav_hover.png);
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <form id="form1" runat="server">
        <br />
        <asp:Label ID="Label1" runat="server" Height="20px" Text="请选择要查看的区域："></asp:Label>
        <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource2" DataTextField="area" DataValueField="area" Height="20px" >
            <asp:ListItem Selected="True">所有</asp:ListItem>
        </asp:DropDownList>
        &nbsp;<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="所有区域" />
        <br />
        <br />
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" 
            CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="Black" GridLines="Vertical" Width="97%" CssClass="txt-center" RowStyle-Height="25px" 
            BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" OnRowDataBound="GridView1_RowDataBound" PageSize="18" >
            <AlternatingRowStyle BackColor="White"/>
            <Columns >
                <asp:BoundField DataField="area" HeaderText="区域" SortExpression="area" />
                <asp:BoundField DataField="illumination" HeaderText="光照" SortExpression="illumination" />
                <asp:BoundField DataField="temperature" HeaderText="温度" SortExpression="temperature" />
                <asp:BoundField DataField="humidity" HeaderText="空气湿度" SortExpression="humidity" />
                <asp:BoundField DataField="soilHum" HeaderText="土壤湿度" SortExpression="soilHum" />
                <asp:BoundField DataField="rain" HeaderText="天气" SortExpression="rain" />
                <asp:BoundField DataField="receiveTime" HeaderText="时间" SortExpression="receiveTime" />
            </Columns>
            <FooterStyle BackColor="#CCCC99" />
            <HeaderStyle CssClass="bgimages"  Font-Bold="True" ForeColor="White" Font-Size="16px"  />
            <PagerSettings FirstPageText="第一页" LastPageText="最后一页" Mode="NextPreviousFirstLast" NextPageText="下一页" PreviousPageText="上一页" />
            <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F7DE" />
            <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#FBFBF2" />
            <SortedAscendingHeaderStyle BackColor="#848384" />
            <SortedDescendingCellStyle BackColor="#EAEAD3" />
            <SortedDescendingHeaderStyle BackColor="#575357" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:smartGardenConnectionString %>" SelectCommand="SELECT [area], [illumination], [temperature], [humidity], [soilHum], [rain], [receiveTime] FROM [dealReceive] WHERE ([area] = @area) ORDER BY [receiveTime] DESC">
            <SelectParameters>
                <asp:ControlParameter ControlID="DropDownList1" Name="area" PropertyName="SelectedValue" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:smartGardenConnectionString %>" SelectCommand="SELECT DISTINCT [area] FROM [dealReceive] ORDER BY [area]"></asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:smartGardenConnectionString %>" SelectCommand="SELECT [area], [illumination], [temperature], [humidity], [soilHum], [receiveTime], [rain] FROM [dealReceive] ORDER BY [receiveTime]"></asp:SqlDataSource>
        <br />
        <br />
        <br />
    </form>
</asp:Content>
